let inpAdd = document.querySelectorAll('.inputs-input');5
let spanAdd = document.querySelectorAll('.answer-question');
let aBtn = document.querySelector('.ask-but-tj-btn');
let num=0;
aBtn.onclick = function () {
    for (let i = 0; i < inpAdd.length; i++) {
        if (inpAdd[i].value == '' || inpAdd[i].value == null) {
            spanAdd[i].style.display = 'inline-block';
            break;
        } else {
            spanAdd[i].style.display = 'none';
            if (inpAdd[i].value != '') {
                // num += 1;
                // if (num == i) {
                location.href = "/wenjian"
                // }

            }
        }
    }


}

$('#feature').on('change', function () {
    // 2.获取选择到的input中的图片信息
    let file = $(this)[0].files[0];
    // 3.实例化formdata
    let formdata = new FormData();
    // 4.把图片信息添加到formdata中
    formdata.append('feature', file);
    // 5.发起ajax请求
    $.ajax({
        type: 'post',
        url: '/postAddUpload',
        data: formdata,
        contentType: false,
        processData: false,
        success: function (data) {
            // console.log(data);
            $('.postimg').show().attr('src', data.picAddr);
            // location.href = "/wenjian"
            // .after('<input type="hidden" name="feature" value="' + data.picAddr + '">')
        }
    })
})